# Maintainer: Jaroslav Lichtblau <svetlemodry@archlinux.org>
# Contributor: Lukas Jirkovsky <l.jirkovsky@gmail.com>
# Contributor: Dmitry N. Shilov <stormblast@land.ru>

pkgname=luminancehdr
pkgver=2.6.1
pkgrel=17
pkgdesc='Open source graphical user interface application that aims to provide a workflow for HDR imaging'
arch=('loong64' 'x86_64')
url='http://qtpfsgui.sourceforge.net/'
license=('GPL')
depends=('exiv2' 'fftw' 'gsl' 'lcms2' 'libraw' 'openexr' 'qt5-webengine' 'qt5-svg'
         'ccfits' 'desktop-file-utils' 'hicolor-icon-theme' 'boost-libs')
makedepends=('cmake' 'boost' 'gtest' 'qt5-tools' 'eigen')
optdepends=('hugin: align image stack functionality')
changelog=$pkgname.changelog
options=('!emptydirs')
source=(https://sourceforge.net/projects/qtpfsgui/files/luminance/$pkgver/luminance-hdr-$pkgver.tar.bz2
        luminancehdr-openexr3.patch
        fix-headers.patch
        exiv2-0.28.patch)
sha512sums=('d909194ff13df1d3a9ad5c08a0fad5b28831c1ff5317ec9240af16b21cc87dff162c9e2433c5ec1103e4a3a5001de14a9a1dd3d75b3cb24433c93694810c24f7'
            '78da713154042f125511ddc7ad184f961c92fa679ff0aa5d33700b619a0eed973722ea9f51c44c58595043ea308f4f3c44f6613b88fbb41e5159849bc0f8741e'
            '6d7ae3df647ffb67a27ef2729c8e8fd04e2b400bd960744dd0172406bc27773156a2b0bd67a7b71157cc59d0f528fbe00882085baa42f503dd506baa2826d0e9'
            '711e64209cba59b218b09715451ddcca3084b020da9bd1baa7decc71e5d3ad7375cba5703bc042e2371e9465c01436a67d0162731718dbef158e207de5266615')

prepare() {
  patch -d luminance-hdr-$pkgver -p1 < luminancehdr-openexr3.patch
  patch -d luminance-hdr-$pkgver -p1 < fix-headers.patch
  patch -d luminance-hdr-$pkgver -p1 < exiv2-0.28.patch # Fix build with exiv2 0.28
}

build() {
  cd "${srcdir}"/luminance-hdr-$pkgver

  cmake -DCMAKE_INSTALL_PREFIX=/usr -DCMAKE_BUILD_TYPE=Release
  make
}

package() {
  cd "${srcdir}"/luminance-hdr-$pkgver

  make DESTDIR="${pkgdir}" install
}
